package cn.dankal.lequ.commom.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 苏彬 on 2016/4/16.
 */
public class FragmentAdapter extends FragmentStatePagerAdapter {
    List<Fragment> fragments;
    ArrayList<String> tablayout_titles;

    public FragmentAdapter(android.support.v4.app.FragmentManager fm, List<android.support.v4.app.Fragment> fragments, ArrayList<String> titles) {
        super(fm);
        this.fragments = fragments;
        this.tablayout_titles = titles;
    }

    @Override
    public android.support.v4.app.Fragment getItem(int position) {
        return fragments.get(position);

    }

    @Override
    public int getCount() {
        return fragments.size();

    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tablayout_titles.get(position);
    }
}
